using System;

namespace PKGames.Plugins.Crashlytics
{
	public class CrashlyticsPluginAndroid : PluginAndroid, ICrashlyticsPlugin
	{
		private const string JavaPackageName = "com.movile.playkids.unityInterfaces";

		private const string JavaClassName = "CrashlyticsPluginUnityInterface";

		private const string LogMethodName = "log";

		private const string LogExceptionMethodName = "logException";

		private const string SetUserIdMethodName = "setUserId";

		private const string SetStringMethodName = "setString";

		public CrashlyticsPluginAndroid()
			: base("com.movile.playkids.unityInterfaces", "CrashlyticsPluginUnityInterface")
		{
		}

		public void Log(string tag, string msg)
		{
			CallStaticMethod("log", tag, msg);
		}

		public void LogException(string msg, string stack)
		{
			string text = stack.Substring(0, stack.IndexOf(Environment.NewLine, StringComparison.Ordinal));
			CallStaticMethod("logException", text, msg, stack);
		}

		public void SetUserId(string id)
		{
			CallStaticMethod("setUserId", id);
		}

		public void SetString(string key, string value)
		{
			CallStaticMethod("setString", key, value);
		}
	}
}
